package tau.dimes.visualization.applet;

import tau.dimes.visualization.applet.data.TraceDataSet;
import tau.dimes.visualization.applet.heatMap.HeatMap;
import tau.dimes.visualization.applet.topology.Topology;

/**
 * A factory class for creating IVisualization implementations.
 */
class VisualizationFactory
{
	/**
	 * Create and initialize an IVisualization implementation.
	 * @param visualizationType Visualization type.
	 * @param applet A reference to the containing applet.
	 * @param traceDataSet A trace data set.
	 * @return An IVisualization implementation.
	 */
	static IVisualization Create(VisualizationType visualizationType, DimesVApplet applet, TraceDataSet traceDataSet)
	{
		IVisualization visualization = CreateInstance(visualizationType);
		
		visualization.setApplet(applet);
		visualization.setTraceDataSet(traceDataSet);
		
		return visualization;
	}
	
	private static IVisualization CreateInstance(VisualizationType visualizationType)
	{
		IVisualization visualization = null;
		
		switch (visualizationType)
		{
		case Topology:
			visualization = new Topology();
			break;
		case HeatMap:
			visualization = new HeatMap();
			break;
		}
		
		return visualization;
	}
}
